import requests
import json
from logger import logger
from jsonpath_rw import jsonpath, parse

headers = {

    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"
}
r = requests.get("https://api.bilibili.com/x/web-interface/view?aid=32899110", headers=headers, verify=False)
print(r.status_code)
text = r.text
logger.info("-----------------222")
print(text)
try:
    json = json.loads(text)
    path = parse('$.code')
    print (eval("str(path.find(json)[0].value) == '0'"))

except Exception:
    logger.error("error:", exc_info=True)

for obj in path.find(json):
    if isinstance(obj.value, list):
        print("list0000000000")
    else:
        print("obj")
    logger.info(obj.value)
